﻿namespace BorgExt
{
    public class ExtensionBase
    {
        public Extension Extension { get; internal set; }

        protected Plugin Plugin
        {
            get { return Extension.ExtensionType.Plugin; }
        }

        protected ExtensionType ExtensionType
        {
            get { return Extension.ExtensionType; }
        }

        protected MetaElementCollection<Plug> Plugs
        {
            get { return Extension.Plugs; }
        }

        protected MetaElementCollection<Slot> Slots
        {
            get { return Extension.Slots; }
        }

        protected Runtime Runtime
        {
            get { return Plugin.runtime; }
        }

        public ExtensionBase()
        {
            Extension = Composer.ActivatorStack.Peek();
        }

        protected void Log(string message, params object[] args)
        {
            Extension.Logger.OnLog(Extension, message, args);
        }

        protected void Log(VerbosityLevel verbosityLevel, string message, params object[] args)
        {
            Extension.Logger.OnLog(verbosityLevel, Extension, message, args);
        }

        protected void Log(LogType logType, string message, params object[] args)
        {
            Extension.Logger.OnLog(logType, Extension, message, args);
        }

        protected void Log(VerbosityLevel verbosityLevel, LogType logType, string message, params object[] args)
        {
            Extension.Logger.OnLog(verbosityLevel, logType, Extension, message, args);
        }
    }
}

